+2005-09-18 Øyvind Kolås <pippin@gimp.org>
+
+ * babl/babl-memory.[ch]: (babl_free), (babl_realloc): made babl_free
+ variadic, and added the potential for a clearing realloc.
+
2005-09-12 Øyvind Kolås <pippin@gimp.org>
* tests/conversions.c: (test_init): code simplification.
/* Free memory allocated by a babl function (note: babl_free
* will complain if memory not allocated by babl is passed.)
+ *
+ * Note: the function is made variadic to be a legal callback
+ * function in some circumstances.
*/
void
-babl_free (void *ptr)
+babl_free (void *ptr,
+ ...)
{
if (!ptr)
return;
}
else if (babl_sizeof (ptr) < size)
{
+#ifdef USE_REALLOC_CLEAR
+ /* not needed yet by babl, if aviodable, preferred, since
+ * it has performance hits where it isn't wanted, a special
+ * function might be better when needd.
+ */
+ ret = babl_calloc (size, 1);
+#else
ret = babl_malloc (size);
+#endif
memcpy (ret, ptr, babl_sizeof (ptr));
babl_free (ptr);
reallocs++;
int babl_memory_sanity (void);
void * babl_malloc (size_t size);
-void babl_free (void *ptr);
+void babl_free (void *ptr,
+ ...);
void * babl_calloc (size_t nmemb,
size_t size);
void * babl_realloc (void *ptr,